package cn.edu.scau.cmi.liweihang.factory;


import cn.edu.scau.cmi.liweihang.simpleFactoryMethod.domain.Meat;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;

public class Control {

	@FXML
	private TextArea textarea;
	@FXML
	private ComboBox comboBox;
	
	MeatFactory meatfactory=null;
	Meat meat=null;
	
	public void production() {
		String meatkind=(String) comboBox.getValue();
		System.out.println(meatkind);
		switch(meatkind) {
		case"PorkFactory":
			meatfactory=new PorkFactory();break;
		case"BeefFactory":
			meatfactory=new BeefFactory();break;
		case"ChickenFactory":
			meatfactory=new ChickenFactory();break;
		}
		meat=meatfactory.cook();
		textarea.appendText(meat.product()+"\n");
		System.out.println(meat.product());
		
	}
}
